package com.crm.service.cluePoolManager;

import com.alibaba.fastjson.JSONObject;
import com.crm.model.entity.cluePoolManager.CluePoolRule;
import com.crm.model.entity.cluePoolManager.ClueReceive;
import com.crm.model.entity.sys.UserAccount;
import com.crm.model.vo.cluePoolManager.ClueReceiveVO;

import java.util.List;
import java.util.Map;

/**
 * @ Author ：pym
 * @ Date   ：2021/1/8 13:01
 */
public interface ClueReceiveDbService {
    /**
     * 线索池详情-线索清单-领取记录
     * @param clueId        ---线索Id
     * @return
     */
    List<ClueReceiveVO> selectClueReceiveVOList(String clueId);

    /**
     *新增一条领取/分配记录
     * @param fromId       ---原线索池id
     * @param toId         ---新线索池id
     * @param clueId       ---线索ID
     * @param accountId    ---被分配/领取人ID
     * @param receiveWay   ---领取方式：1-领取；2:分配
     * @return
     */
    Boolean insertClueReceive(String fromId,String toId,String clueId,String accountId,Integer receiveWay);

    /**
     * @author wll
     *info 同一线索池线索的领取时间间隔是否满足
     */
    JSONObject TimeIntervalFromLastClue(String poolId,Integer continueTimeInterval,UserAccount userAccount);


    /**
     * @author wll
     * info 线索领取量是否超过该池设置的最大领取量
     */
    JSONObject selectClueReceiveInfo(UserAccount userAccount, String poolId, CluePoolRule cluePoolRuleInfo);

    /**
     * 根据线索池id查询传入月份领取数量
     * @param cluePoolId
     * @param yearMonth
     * @return
     */
    long selectReceiveCountForCurrentMonthByPoolId(String cluePoolId,String yearMonth);

    /**
     * 根据线索池id查询线索池领取数量
     * @param cluePoolId
     * @return
     */
    long selectClueReceiveByPoolId(String cluePoolId);

    /**
     *(线索清单)线索领取次数
     * @param clueId ---线索ID
     * @return
     */
    long selectReceiveCountByClueId(String clueId);
}
